package com.jwm.client;

import com.jwm.platform.ReceiveController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * @author 崔洁
 */
@Component
public class AdminCheck {
    public static boolean isUseAdmin() {
        try {
            ProcessBuilder builder = new ProcessBuilder("net", "session");
            Process process = builder.start();
            BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream(), "UTF-8"));
            reader.readLine();
            return process.waitFor() == 0;
        } catch (Exception e) {
            return false;
        }
    }
}
